<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :span="24">
          <a-col  :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="代理机构名称" :labelCol="labelCol" prop="agencyName">
              <j-input v-model="queryParam.agencyName" placeholder="请输入代理机构名称"  ></j-input>
            </a-form-item>
          </a-col>
          <a-col  :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="代理机构编码" :labelCol="labelCol" prop="legalCode">
              <j-input v-model="queryParam.legalCode" placeholder="请输入代理机构编码"  ></j-input>
            </a-form-item>
          </a-col>

          <a-col  :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="审核状态" :labelCol="labelCol"   prop="state">
              <j-dict-select-tag
                placeholder="请选择用户等级"
                v-model="queryParam.state"
                dictCode="regist_user_state"
              />
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <!--              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
              </a>-->
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">
     <!-- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-button type="primary" icon="download" @click="handleExportXls('agency_legal_check_log')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>-->
      <!-- 高级查询区域 -->
      <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
      </a-dropdown> -->
    </div>

    <!-- table区域-begin -->
    <div>
      <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div> -->

      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
        </template>

        <span slot="action" slot-scope="text, record">
          <a v-if="record.state == 0" @click="handleDetail(record)">审核</a>
          <a-divider type="vertical" />
          <a @click="$router.push({path:'/userInfo-legal',query:{id:record.sysUserId}})">详情</a>
        </span>

      </a-table>
    </div>

    <agency-legal-check-log-modal ref="modalForm" @ok="modalFormOk"></agency-legal-check-log-modal>
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { filterMultiDictText } from '@/components/dict/JDictSelectUtil'
  import {putAction,getFileAccessHttpUrl,httpAction, getAction} from '@/api/manage'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import AgencyLegalCheckLogModal from './modules/AgencyLegalCheckLogModal'

  export default {
    name: 'AgencyLegalCheckLogList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      AgencyLegalCheckLogModal
    },
    data () {
      return {
        description: '代理机构审核页面',
        // 表头
        columns: [
          // {
          //   title: '#',
          //   dataIndex: '',
          //   key:'rowIndex',
          //   width:60,
          //   align:"center",
          //   customRender:function (t,r,index) {
          //     return parseInt(index)+1;
          //   }
          // },

          {
            title:'代理机构名称',
            align:"center",
            dataIndex: 'agencyName'
          },
          {
            title:'账号(组织机构代码/统一社会信用代码号)',
            align:"center",
            dataIndex: 'legalCode'
          },
          {
            title:'是否绑定CA',
            align:"center",
            dataIndex: 'isCa_dictText'
          },
          {
            title:'申请时间',
            align:"center",
            dataIndex: 'createTime'
          },
          {
            title:'审核状态',
            align:"center",
            dataIndex: 'state_dictText'
          },
          {
            title:'审核人',
            align:"center",
            dataIndex: 'checkBy'
          },
          {
            title:'审核时间',
            align:"center",
            dataIndex: 'checkTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'审核备注',
            align:"center",
            dataIndex: 'remark'
          },

          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/register/agencyLegalCheckLog/selCheckLoglist",
          check: "/register/agencyLegalCheckLog/check",
        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
    this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      handleDetail:function(record){
        this.$refs.modalForm.edit(record);
        this.$refs.modalForm.title="详情";
        this.$refs.modalForm.disableSubmit = false;
      },
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];

        fieldList.push({type:'string',value:'agencyName',text:'代理机构名称'})
        fieldList.push({type:'string',value:'legalCode',text:'账号(组织机构代码/统一社会信用代码号)'})
        fieldList.push({type:'string',value:'isCa',text:'是否绑定CA'})
        fieldList.push({type:'string',value:'createTime',text:'申请时间'})
        fieldList.push({type:'string',value:'state', text: '审核状态', dictCode: 'regist_user_state'})
        fieldList.push({type:'string',value:'checkBy',text:'审核人'})
        fieldList.push({type:'date',value:'checkTime',text:'审核时间'})
        fieldList.push({type:'string',value:'remark',text:'审核备注'})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
